<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>车类产品保单明细 管理</title>
<style type="text/css">
</style>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<body class="iframeBody">
	<div class="Wrapper">
		<div class="searchArea">
			<form id="searchBar">
				<div class="fieldset1 clearFix">
					<div class="fieldBox">
						<div class="label">名称</div>
						<div class="field">
							<input name="" id="" type="text" class="ui-textbox" value="">
						</div>
					</div>

					<div class="clearFix"></div>
					<div class="btnsBox">
						<span id="searchBtn" class="sq-button sq-button-hasicon"><i
							class="sqBtnIco_1"></i>查询</span> <span id="clearBtn"
							class="sq-button sq-button-hasicon"><i class="sqBtnIco_19"></i>清空</span>
						<span id="addBtn" class="sq-button sq-button-hasicon"><i
							class="sqBtnIco_3"></i>新增</span> <span id="changeBtn"
							class="sq-button sq-button-hasicon"><i class="sqBtnIco_4"></i>修改</span>
						<span id="delBtn" class="sq-button sq-button-hasicon"><i
							class="sqBtnIco_7"></i>删除</span> <input id="resetBtn" type="reset"
							value="重置" class="l-button l-button-reset Hide" />
					</div>
				</div>
			</form>
		</div>
		<div id="ligergrid1" class="sq-grid"></div>
	</div>

	<script type="text/javascript">
    var grid = null, menu = null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/insurance/insPlcPrdDtl/initList.do',
            method: 'get',
            columns: [
                {display: '保单ID', name: 'insPlcId', minWidth: 100, align: 'left', enabledSort: true},
				{display: '产品ID', name: 'prdId', minWidth: 100, align: 'left', enabledSort: true},
				{display: '产品名称', name: 'prdNm', minWidth: 100, align: 'left', enabledSort: true},
				//{display: '产品类型代码PRD0001', name: 'prdTypCdNm', minWidth: 100, align: 'left', enabledSort: true},
				{display: 'null', name: 'prdMdl', minWidth: 100, align: 'left', enabledSort: true},
				{display: '厂商', name: 'mfrNm', minWidth: 100, align: 'left', enabledSort: true},
				{display: '供应商', name: 'splNm', minWidth: 100, align: 'left', enabledSort: true},
				{display: '发动机编号', name: 'engMdl', minWidth: 100, align: 'left', enabledSort: true},
				{display: '车架号', name: 'vinNo', minWidth: 100, align: 'left', enabledSort: true},
				{display: '整机号', name: 'whEngNo', minWidth: 100, align: 'left', enabledSort: true},
				{display: '底盘号', name: 'chaNo', minWidth: 100, align: 'left', enabledSort: true},
				{display: '单价', name: 'unitPrc', minWidth: 100, align: 'left', enabledSort: true},
				{display: '发票号', name: 'invNo', minWidth: 100, align: 'left', enabledSort: true},
				{display: '合格证号', name: 'certNo', minWidth: 100, align: 'left', enabledSort: true},
		
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            //isScroll: false,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
            /* onRenderComplete: function () {
             iframeResize ();
             } */
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "*Cd": " "
            });
        });
        
        var callback = function () {
            grid.reload();
        };

        /* 新增 */
        $("#addBtn").click(function (event) {
            $.ligerDialog.open({
                cls: 'noBorder_Dialog',
                width: 550,
                height: 500,
                title: '新增车类产品保单明细',
                url:'<%=path%>/insurance/insPlcPrdDtl/toAddPage.do'
            });
            //Add_navTab("InsPlcPrdDtl_1", "新增车类产品保单明细", '<%=path%>/insurance/insPlcPrdDtl/toAddPage.do', callback);
        });

        /* 修改 */
        $("#changeBtn").click(function (event) {
            var selectedRows = grid.getSelectedRows();
            if (selectedRows.length != 1) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
                return;
            }
            var _id=selectedRows[0].id;
            $.ligerDialog.open({
                cls: 'noBorder_Dialog',
                width: 550,
                height: 500,
                title: '修改车类产品保单明细',
                url:'<%=path%>/insurance/insPlcPrdDtl/toModifyPage.do?id='+_id
            });
            //Add_navTab('InsPlcPrdDtl_2'+_id, "修改车类产品保单明细", '<%=path%>/insurance/insPlcPrdDtl/toModifyPage.do?id='+_id, callback);
        });

        /* 删除 */
        $("#delBtn").click(function () {
            var selectedRows = grid.getSelectedRows();
            if (selectedRows.length == 0) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_MORE_ROW, SQ_type: "warning"});
                return;
            }
            var _ids = [];
            for (var index in selectedRows) {
                _ids.push(selectedRows[index].id);
            }

            $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
                if (flag == false)return;
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {ids: JSON.stringify(_ids)},
                    url: '<%=path%>
		/insurance/insPlcPrdDtl/removeByIds.do',
																beforeSend : function() {
																	wait_dialog = $.ligerDialog
																			.SQalert({
																				content : LogUtils.LOG_CMM_DATA_LOADING,
																				SQ_type : "waitting"
																			});
																},
																success : function(
																		msg) {
																	wait_dialog
																			.close();
																	if (msg.success == 1) {
																		$.ligerDialog
																				.SQalert({
																					content : msg.info,
																					SQ_type : "success"
																				});
																		grid
																				.reload();
																	} else {
																		$.ligerDialog
																				.SQalert({
																					content : msg.info,
																					SQ_type : "error"
																				});
																	}
																}
															});
												});
							});

		});
	</script>

</body>
</html>
